home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1993 July / Internet Tools.iso / RockRidge / mail / pp / pp-6.0 / Format / asn / f_6937.c < prev    next >
Encoding:
C/C++ Source or Header  |  1991-12-18  |  2.0 KB  |  114 lines

  1. /* f_6937.c: motis-86-6937 Encoder/Decoder Function Routines */
  2.  
  3. # ifndef lint
  4. static char Rcsid[] = "@(#)$Header: /xtel/pp/pp-beta/Format/asn/RCS/f_6937.c,v 6.0 1991/12/18 20:15:43 jpo Rel $";
  5. # endif
  6.  
  7. /*
  8.  * $Header: /xtel/pp/pp-beta/Format/asn/RCS/f_6937.c,v 6.0 1991/12/18 20:15:43 jpo Rel $
  9.  *
  10.  * $Log: f_6937.c,v $
  11.  * Revision 6.0  1991/12/18  20:15:43  jpo
  12.  * Release 6.0
  13.  *
  14.  */
  15.  
  16.  
  17.  
  18.  
  19. #include "head.h"
  20. #include "IOB-types.h"
  21. #include "asn.h"
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28. /* ------------------------  Start Routines --------------------------------- */
  29.  
  30.  
  31.  
  32.  
  33. decode_motis_6937(body)
  34. ASNBODY        **body;
  35. {
  36.     PE    pe;
  37.     int    retval;
  38.     struct type_IOB_ISO6937Data *asndata;
  39.  
  40.     PP_TRACE (("decode_motis6937()"));    
  41.  
  42.     pe = asn_rd_stdin (IGNORE_PRMS);
  43.  
  44.     retval = decode_IOB_ISO6937Data (pe, 1, NULLIP, NULLVP, &asndata);
  45.  
  46.     if (retval == NOTOK)
  47.         pe_done (pe);
  48.  
  49.     pe_free (pe);
  50.  
  51.     /* -- set ASNBODY -- */
  52.     struct2body (asndata, body);
  53.  
  54.     free_IOB_ISO6937Data (asndata);
  55. }
  56.  
  57.  
  58.  
  59.  
  60. encode_motis_6937(ppe, body)
  61. PE    *ppe;
  62. ASNBODY    *body;
  63. {
  64.     int    retval = NOTOK;
  65.     PE    pe;
  66.     struct type_IOB_ISO6937TextBodyPart    *info = NULL;
  67.  
  68.     PP_TRACE (("encode_motis6937()"));    
  69.  
  70.     /* -- set Data structure -- */
  71.     set_6937_data (&info, body);
  72.  
  73.     retval = encode_IOB_ISO6937TextBodyPart (&pe, 1, NULLIP, NULLVP, info);
  74.     if (retval == NOTOK)
  75.         pe_done (pe);    /* -- exit -- */
  76.  
  77.     pe -> pe_class    = PE_CLASS_CONT;
  78.     pe -> pe_id    = 13;
  79.     *ppe = pe;
  80.  
  81.     free_IOB_ISO6937TextBodyPart (info);
  82.     return OK;
  83. }
  84.  
  85.  
  86.  
  87.  
  88. /* -----------------------  Static  Routines  ------------------------------- */
  89.  
  90.  
  91.  
  92.  
  93. static set_6937_data (dstruct, body)
  94. struct type_IOB_ISO6937TextBodyPart    **dstruct;
  95. ASNBODY        *body;
  96. {
  97.     struct type_IOB_ISO6937TextBodyPart    *tbptr;
  98.  
  99.  
  100.     PP_TRACE (("set_6937_data()"));
  101.  
  102.     /* -- malloc main structure -- */
  103.     tbptr = (struct type_IOB_ISO6937TextBodyPart *)
  104.         smalloc (sizeof *tbptr);
  105.     bzero (tbptr, sizeof *tbptr);
  106.  
  107.     tbptr -> parameters = (struct type_IOB_ISO6937Parameters *)
  108.         smalloc (sizeof *tbptr -> parameters);
  109.     bzero (tbptr -> parameters, sizeof *tbptr -> parameters);
  110.  
  111.     body2struct (body, &tbptr -> data);
  112.     *dstruct = tbptr;
  113. }
  114.